<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    const strToBoolean = ( str ) => {
        if ( str == "true" || str == "false" ) {
            return JSON.parse( str );
        } else {
            return str;
        }
    };
    let configData = [


        {
            "configId": 270,
            "parameterName": "变电所状态名称",
            "parameterKey": "substation",
            "parameterGroup": "imine-management-web3d",
            "parameterType": 4,
            "dropDownBox": null,
            "parameterUnit": null,
            "parameterDesc": "配置变电所点号值对应名称",
            "parameterValueId": 207,
            "parameterValue": {
                "substation": [
                    {
                        "headName": "点号值",
                        "customValue": {
                            "type": "false",
                            "text": "分闸"
                        },
                        "customName": {
                            "type": "类型",
                            "text": "显示名称"
                        },
                        "headValue": "0"
                    },
                    {
                        "headName": "点号值",
                        "customValue": {
                            "type": "true",
                            "text": "合闸"
                        },
                        "customName": {
                            "type": "类型",
                            "text": "显示名称"
                        },
                        "headValue": "1"
                    }
                ]
            },
            "groupSort": 7,
            "groupName": "自控系统"
        },
        {
            "configId": 271,
            "parameterName": "水泵房状态名称",
            "parameterKey": "pumpstation",
            "parameterGroup": "imine-management-web3d",
            "parameterType": 4,
            "dropDownBox": null,
            "parameterUnit": null,
            "parameterDesc": "配置水泵房点号值对应名称",
            "parameterValueId": 208,
            "parameterValue": {
                "pumpstation": [
                    {
                        "headName": "点号值",
                        "customValue": {
                            "type": "false",
                            "text": "关"
                        },
                        "customName": {
                            "type": "类型",
                            "text": "显示名称"
                        },
                        "headValue": "0"
                    },
                    {
                        "headName": "点号值",
                        "customValue": {
                            "type": "true",
                            "text": "开"
                        },
                        "customName": {
                            "type": "类型",
                            "text": "显示名称"
                        },
                        "headValue": "1"
                    }
                ]
            },
            "groupSort": 7,
            "groupName": "自控系统"
        },
        {
            "configId": 272,
            "parameterName": "通风机状态名称",
            "parameterKey": "ventmachine",
            "parameterGroup": "imine-management-web3d",
            "parameterType": 4,
            "dropDownBox": null,
            "parameterUnit": null,
            "parameterDesc": "配置水泵房点号值对应名称",
            "parameterValueId": 209,
            "parameterValue": {
                "ventmachine": [
                    {
                        "headName": "点号值",
                        "customValue": {
                            "type": "false",
                            "text": "关闭"
                        },
                        "customName": {
                            "type": "类型",
                            "text": "显示名称"
                        },
                        "headValue": "0"
                    },
                    {
                        "headName": "点号值",
                        "customValue": {
                            "type": "true",
                            "text": "运行"
                        },
                        "customName": {
                            "type": "类型",
                            "text": "显示名称"
                        },
                        "headValue": "1"
                    }
                ]
            },
            "groupSort": 7,
            "groupName": "自控系统"
        },
        {
            "configId": 273,
            "parameterName": "皮带状态名称",
            "parameterKey": "belt",
            "parameterGroup": "imine-management-web3d",
            "parameterType": 4,
            "dropDownBox": null,
            "parameterUnit": null,
            "parameterDesc": "配置皮带点号值对应名称",
            "parameterValueId": 210,
            "parameterValue": {
                "belt": [
                    {
                        "headName": "点号值",
                        "customValue": {
                            "type": "false",
                            "text": "停止"
                        },
                        "customName": {
                            "type": "类型",
                            "text": "显示名称"
                        },
                        "headValue": "0"
                    },
                    {
                        "headName": "点号值",
                        "customValue": {
                            "type": "true",
                            "text": "运行"
                        },
                        "customName": {
                            "type": "类型",
                            "text": "显示名称"
                        },
                        "headValue": "1"
                    }
                ]
            },
            "groupSort": 7,
            "groupName": "自控系统"
        },
        {
            "configId": 274,
            "parameterName": "副井提升状态名称",
            "parameterKey": "winch",
            "parameterGroup": "imine-management-web3d",
            "parameterType": 4,
            "dropDownBox": null,
            "parameterUnit": null,
            "parameterDesc": "配置副井提升点号值对应名称",
            "parameterValueId": 211,
            "parameterValue": {
                "winch": [
                    {
                        "headName": "点号值",
                        "customValue": {
                            "type": "false",
                            "text": "关闭"
                        },
                        "customName": {
                            "type": "类型",
                            "text": "显示名称"
                        },
                        "headValue": "0"
                    },
                    {
                        "headName": "点号值",
                        "customValue": {
                            "type": "true",
                            "text": "运行"
                        },
                        "customName": {
                            "type": "类型",
                            "text": "显示名称"
                        },
                        "headValue": "1"
                    }
                ]
            },
            "groupSort": 7,
            "groupName": "自控系统"
        },
        {
            "configId": 275,
            "parameterName": "掘进机状态名称",
            "parameterKey": "boringmachine",
            "parameterGroup": "imine-management-web3d",
            "parameterType": 4,
            "dropDownBox": null,
            "parameterUnit": null,
            "parameterDesc": "配置掘进机点号值对应名称",
            "parameterValueId": 212,
            "parameterValue": {
                "boringmachine": [
                    {
                        "headName": "点号值",
                        "customValue": {
                            "type": "false",
                            "text": "关闭"
                        },
                        "customName": {
                            "type": "类型",
                            "text": "显示名称"
                        },
                        "headValue": "0"
                    },
                    {
                        "headName": "点号值",
                        "customValue": {
                            "type": "true",
                            "text": "运行"
                        },
                        "customName": {
                            "type": "类型",
                            "text": "显示名称"
                        },
                        "headValue": "1"
                    }
                ]
            },
            "groupSort": 7,
            "groupName": "自控系统"
        },
        {
            "configId": 276,
            "parameterName": "采煤机状态名称",
            "parameterKey": "shearer",
            "parameterGroup": "imine-management-web3d",
            "parameterType": 4,
            "dropDownBox": null,
            "parameterUnit": null,
            "parameterDesc": "配置采煤机点号值对应名称",
            "parameterValueId": 213,
            "parameterValue": {
                "shearer": [
                    {
                        "headName": "点号值",
                        "customValue": {
                            "type": "false",
                            "text": "关闭"
                        },
                        "customName": {
                            "type": "类型",
                            "text": "显示名称"
                        },
                        "headValue": "0"
                    },
                    {
                        "headName": "点号值",
                        "customValue": {
                            "type": "true",
                            "text": "运行"
                        },
                        "customName": {
                            "type": "类型",
                            "text": "显示名称"
                        },
                        "headValue": "1"
                    }
                ]
            },
            "groupSort": 7,
            "groupName": "自控系统"
        },
        {
            "configId": 277,
            "parameterName": "综采面设备状态名称",
            "parameterKey": "shearerEquipment",
            "parameterGroup": "imine-management-web3d",
            "parameterType": 4,
            "dropDownBox": null,
            "parameterUnit": null,
            "parameterDesc": "配置综采面设备点号值对应名称",
            "parameterValueId": 214,
            "parameterValue": {
                "shearerEquipment": [
                    {
                        "headName": "点号值",
                        "customValue": {
                            "type": "false",
                            "text": "异常"
                        },
                        "customName": {
                            "type": "类型",
                            "text": "显示名称"
                        },
                        "headValue": "0"
                    },
                    {
                        "headName": "点号值",
                        "customValue": {
                            "type": "true",
                            "text": "正常"
                        },
                        "customName": {
                            "type": "类型",
                            "text": "显示名称"
                        },
                        "headValue": "1"
                    }
                ]
            },
            "groupSort": 7,
            "groupName": "自控系统"
        },
        {
            "configId": 268,
            "parameterName": "多环境配置",
            "parameterKey": "pathUrl",
            "parameterGroup": "imine-management-web3d",
            "parameterType": 4,
            "dropDownBox": null,
            "parameterUnit": null,
            "parameterDesc": "三维平台环境IP，支持多环境配置",
            "parameterValueId": 218,
            "parameterValue": {
                "pathUrl": [
                    {
                        "headName": "当前环境",
                        "customValue": {
                            "videoMqttUsername": "admin",
                            "reportWebsocket": "ws://172.23.57.52:9999/esb",
                            "uploadPro": "http://172.23.57.52:9999/oss",
                            "fileReadPro": "http://172.23.57.52:9999/preview",
                            "proFlv": "http://172.23.57.52:1888",
                            "gisUrl": "ws://172.23.57.12:9999/gis/websocket/portal",
                            "videoMqttUrl": "172.23.57.26:9001",
                            "videoMqttPassword": "root1234"
                        },
                        "customName": {
                            "videoMqttUsername": "AI视频用户名",
                            "reportWebsocket": "自动化websocket",
                            "uploadPro": "oss服务器地址",
                            "fileReadPro": "文件预览服务器地址",
                            "proFlv": "视频推流服务器地址",
                            "gisUrl": "gis websocket地址",
                            "videoMqttUrl": "AI视频地址",
                            "videoMqttPassword": "AI视频密码"
                        },
                        "headValue": "172.23.57.52"
                    }
                ]
            },
            "groupSort": 9,
            "groupName": "环境配置"
        }
    ]

    // 处理pathurl
    configData.forEach( ( i ) => {
        if ( i.parameterType == 4 ) {
            let pathObj = {};
            i.parameterValue[i.parameterKey].forEach( ( e ) => {
                if ( e.customValue.type ) {
                    e.customValue.type = strToBoolean( e.customValue.type )
                }
                console.log( e.customValue )
                pathObj[e.headValue] = e.customValue;
            } );
            i.parameterValue[i.parameterKey] = pathObj;
        }
    } );
    // 处理所有配置数据
    let obj = {};
    configData.forEach( ( item ) => {
        obj[item.parameterKey] = item.parameterValue[item.parameterKey];
    } );
    console.log( obj )
</script>

</html>